home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
graphics
/
rmtc02.zip
/
WRITEXGF.C
< prev
Wrap
Text File
|
1992-04-06
|
759b
|
40 lines
#include <stdio.h>
#include <alloc.h>
#include <graphics.h>
void main()
{
void *imgBuf;
FILE *F;
int driver = EGA;
int mode = EGAHI;
unsigned int size;
initgraph(&driver, &mode, "");
setfillstyle(SOLID_FILL,BLUE);
bar(0,0,639,349);
setfillstyle(SLASH_FILL,LIGHTGRAY);
bar(2,2,49,49);
setcolor(WHITE);
rectangle(1,1,50,50);
setcolor(LIGHTGREEN);
outtextxy(2,10,"RASTER");
outtextxy(2,30,"MASTER");
size=imagesize(1,1,50,50);
imgBuf = malloc(size);
getimage(1,1,50,50,imgBuf);
if ((F=fopen("sample.xgf","wb")) == NULL)
{
closegraph();
printf("Can't open file!\n");
exit(0);
}
fwrite(imgBuf,size,1,F);
fclose(F);
free(imgBuf);
getch();
closegraph();
}